import { get, post } from "@/http/request";

// -------------------- 接口相关 类型定义 --------------------
export interface LoginRequest {
  username: string;
  password: string;
}

// 刷新登录信息需要的参数
export interface reLoginRequest {
  accessToken: string;
}

export interface LoginResponse {
  accessToken: string;
  username: string;
  roles: string[];
}

//  ------------------------- 定义接口 --------------------
export const userLogin = async (data: LoginRequest) => {
  return post<LoginResponse>({}, "/login", data);
};
export const getUserInfo = async (data?: reLoginRequest) => {
  return get<LoginResponse>({}, "/getUserInfo", data);
};
